package com.itao.springboot.controller;

import com.itao.springboot.annotation.RateLimiter;
import com.itao.springboot.bean.LogTestModel;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author sjt
 * @Date 2025/3/10 9:20
 */
@RestController
@RequestMapping
public class RateLimiterController {


    @GetMapping("/rateLimiter")
    @RateLimiter(
            msg = "系统繁忙，请稍候再试。",
            key = "#logTestModel.orderId",
            time = 10,
            count = 2
    )
    public String rateLimiter(@RequestBody LogTestModel logTestModel) {

        return "rateLimiter";
    }
}
